<?php

namespace Model;

//Klass för skapande & hämtning av array innehållande topic-objekt
class TopicArray 
{
        private $topics = array();
              
        public function Add(Topic $topic)
		{
                $this->topics[] = $topic; 
        }
        
        public function Get() 
        {
                return $this->topics;
        }
		
        public function Count() 
        {
                return count($this->topics);
        }		
}

//Klass för konsruering av topic-objekt.
class Topic
{
        private $topicId; //Int
        private $userId; //Int
        private $header; //String
        private $date; //Date
        private $content; //String
        private $userName; //String   
        private $postCount; //int
        
        //Konstruktor
        public function __construct($topicId, $userId, $header, $date, $content, $userName, $postCount)
		{
                $this->topicId = $topicId;
				$this->userId = $userId;
                $this->header = $header;
				$this->date = $date;
 				$this->content = $content;               
                $this->userName = $userName;
				$this->postCount = $postCount;

        }

		//Publika funktioner som returnerar objektets delar separat		
        
        public function getId() 
        {
                return $this->topicId;
        }

        public function getUserId() 
        {
                return $this->userId;
        }
        
        public function getHeader()
		{
                return $this->header;
        }
        
        public function getDate() 
        {
                return $this->date;                         
        }
		
		public function getUserName()
		{
				return $this->userName;
		}
		
		public function getContent()
		{
				return $this->content;
		}
		
		public function getPostCount()
		{
				return $this->postCount;
		}							
}